package com.skywolf.chem.common.sysconfig.utils;

/**
 * Created by pei_pei on 2020/10/27.
 */
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;

public final class TLArrayUtils {
    public TLArrayUtils() {
    }

    public static Set arrayToSet(@Nullable Object source) {
        return new HashSet(Arrays.asList(ObjectUtils.toObjectArray(source)));
    }

    public static List arrayToList(@Nullable Object source) {
        return Arrays.asList(ObjectUtils.toObjectArray(source));
    }

    public static Set listToSet(List source) {
        return (Set)(source == null?Collections.emptySet():new HashSet(source));
    }
}

